﻿using Coldairarrow.Entity.DTO;
using Coldairarrow.Entity.PB;
using Coldairarrow.Util;
using Coldairarrow.Util.ClassLibrary;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Coldairarrow.Business.PB
{
    public partial interface IPB_CirculationBillBusiness
    {
        Task<PageResult<PB_CirculationBill>> GetDataListAsync(PageInput<ConditionDTO> input);
        Task<PB_CirculationBill> GetTheDataAsync(string id);
        Task AddDataAsync(PB_CirculationBill data);
        Task UpdateDataAsync(PB_CirculationBill data);
        Task DeleteDataAsync(List<string> ids);

        /// <summary>
        /// 分页获取工序报工Pc数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        /// 
   
        Task<PageResult<PB_CirculationBillListDto>> GetDataCirculationBillList(PageInput<PB_CirculationBillListConditionDTO> input );
        /// <summary>
        /// 半成品入库流水
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<PageResult<PB_CirculationBillDetailDTO>> GetDataDTOListAsync(PageInput<PB_CirculationBillConditionDTO> input);
        /// <summary>
        /// 半成品余量
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<PageResult<PB_CirculationBillSurplusDTO>> GetDataSurplusDTOListAsync(PageInput<PB_CirculationBillSurplusConditionDTO> input);
        /// <summary>
        /// 获取喷涂作业中列表
        /// </summary>
        /// <param name="DeviceId"></param>
        /// <returns></returns>
        Task<List<CirculationBillList>> GetWorkingListAsync(string DeviceId);
        /// <summary>
        /// 生产计划执行A1,A4车间
        /// </summary>
        /// <param name="data">Time时间,DepartmentId部门</param>
        /// <returns></returns>
        Task<List<ProductionPlanExecutionDto>> GetProductionPlaList(ParameterData data);
        /// <summary>
        /// 大屏显示指定车间当日是否有报工
        /// </summary>
        /// <param name="WorkShopName">车间名称,比如"A1车间","A4车间"</param>
        /// <param name="Day">前第几天的当日</param>
        /// <returns>"暂无数据"，""</returns>
        ScreenDisplayValue3DTO GetHaveData(string WorkShopName, int Day);
        /// <summary>
        /// 大屏显示当日各工序派工合格率
        /// </summary>
        /// <param name="WorkShopName">车间名称,比如"A1车间","A4车间"</param>
        /// <param name="Day">前第几天的当日</param>
        /// <returns>当日各工序派工合格率</returns>
        Task<List<PB_DispatchDetailPassRateDTO>> GetTodayPassRateByNameAsync(string WorkShopName, int Day);
        /// <summary>
        /// 工单看板
        /// </summary>
        /// <param name="WorkShopName">车间名称(A1,A4)</param>
        /// <param name="Day">前第几天的当日</param>
        /// <returns>当日各派工完成率</returns>
        Task<List<PB_CirculationBillDispatchPadDTO>> GetTodayPassRateAsync(string WorkShopName, int Day);
        /// <summary>
        /// 生产维度查询报表
        /// </summary>
        /// <param name="input">查询条件</param>
        /// <returns></returns>
        Task<PageResult<PB_CirculationBillDataReportDTO>> GetCirculationBillDataReport(PageInput<PB_CirculationBillDataReportConditionDTO> input);
        /// <summary>
        /// 计划维度查询报表
        /// </summary>
        /// <param name="input">查询条件</param>
        /// <returns></returns>
        Task<PageResult<PB_CirculationBillDataReportDTO>> GetOrderDataReport(PageInput<PB_CirculationBillDataReportConditionDTO> input);
        /// <summary>
        ///获取钉钉用户工资明细
        /// </summary>
        /// <returns></returns>
        Task<List<EmployeeSalaryQuery>> GetDingUserWages(EmployeeSalaryQuerySeach Seach);
        /// <summary>
        /// 获取月份用户报工工资明细
        /// </summary>
        /// <param name="Seach"></param>
        /// <returns></returns>
        Task<List<EmployeeSalaryQueryMonth>> GetDingUserMonthWages(EmployeeSalaryQueryMonthSeach Seach);

        /// <summary>
        /// 托盘领取详情
        /// </summary>
        /// <param name="trayId">托盘Id</param>
        /// <param name="CirBillId">流转卡Id</param>
        /// <returns></returns>
        Task<List<CirculationBillItemDTO>> GetCirculationBillItemAsync(string trayId,string CirBillId);

         

        #region  半成品领料

        /// <summary>
        /// 判断派工单是否是自己的派工单
        /// </summary>
        /// <param name="DispatchDetailQrCode">派工单明细二维码</param>
        /// <returns></returns>
        Task<PB_DispatchDetail> GetDispatchDetailAsync(string DispatchDetailQrCode);

        /// <summary>
        /// 获取流转卡对应的半成品信息
        /// </summary>
        /// <param name="CirBillQrCode">流转卡二维码</param>
        /// <returns></returns>
        Task<ReceiveCirBillMaterialDTO> GetReceiveCirBillMaterialDataAsync(string CirBillQrCode);

        /// <summary>
        /// 半成品领取保存
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        Task SaveReceiveMaterialAsync(ReceiveMaterialDTO data);

        #endregion

        #region 物料完工接收流转单信息 并生产包码入库通知单
         Task<string> SubmitBlackScanning(BlackScanningDto blackScanningDto, MongoDBOptions _mongodbOptions, RedisOptions _redisOptions);
        #endregion


    }

    #region  半成品领料Model

    /// <summary>
    /// 根据流转卡获取半成品信息
    /// </summary>
    public class ReceiveCirBillMaterialDTO
    {
        /// <summary>
        /// 流转卡Id
        /// </summary>
        public string CirBillId { get; set; }

        /// <summary>
        /// 物料Id
        /// </summary>
        public string MaterialId { get; set; }

        /// <summary>
        /// 物料名称    
        /// </summary>
        public string MaterialName { get; set; }

        /// <summary>
        /// 物料编码    
        /// </summary>
        public string MaterialCode { get; set; }

        /// <summary>
        /// 物料规格    
        /// </summary>
        public string MaterialSpec { get; set; }

        /// <summary>
        /// 流转卡接收人
        /// </summary>
        public string Receiver { get; set; }

        /// <summary>
        /// 半成品未领取数量    
        /// </summary>
        public Double? Nums { get; set; }

        /// <summary>
        /// 流转卡二维码
        /// </summary>
        public string QrCode { get; set; }

    }

    /// <summary>
    /// 半成品领取保存传值
    /// </summary>
    public class ReceiveMaterialDTO
    {
        /// <summary>
        /// 派工单明细二维码
        /// </summary>
        public string DispatchDetailQrCode { get; set; }

        /// <summary>
        /// 托盘二维码
        /// </summary>
        public string TrayQrCode { get; set; }

        /// <summary>
        /// 流转卡二维码
        /// </summary>
        public string CirBillQrCode { get; set; }

        /// <summary>
        /// 本次领取数量
        /// </summary>
        public Double? ReceiveNums { get; set; }

    }

    #endregion

    #region 托盘领料详情

    public class CirculationBillItemDTO
    {
        /// <summary>
        /// 领取Id
        /// </summary>
        public string Id { get; set; }

        /// <summary>
        /// 领取人Id
        /// </summary>
        public string CollectionUserId { get; set; }

        /// <summary>
        /// 领取人姓名
        /// </summary>
        public string CollectionUserName { get; set; }

        /// <summary>
        /// 领取时间
        /// </summary>
        public DateTime? CollectionTime { get; set; }

        /// <summary>
        /// 领取数量
        /// </summary>
        public double? Nums { get; set; }


    }

    #endregion

}